const data = [
  { name: "js", price: 100 },
  { name: "mysql", price: 212 },
  { name: "vue.js", price: 98 }
];
class Lesson {
  constructor(data) {
    this.model = data;
  }
  get price() {
    return this.model.price;
  }
  get name() {
    return this.model.name;
  }
  //批量生成对象
  static createBatch(data) {
    return data.map(item => new Lesson(item));
  }
  //最贵的课程
  static MaxPrice(collection) {
    return collection.sort((a, b) => b.price - a.price)[0];
  }
}
const lessons = Lesson.createBatch(data);
console.log(lessons);
console.log(Lesson.MaxPrice(lessons).name);
console.log('-----------------------\n')
console.dir(Lesson)
console.log(new Lesson)
console.log(JSON.stringify(lessons[1]));
lessons[1].price = '234234'
console.log('-----------------------\n')
console.log(JSON.stringify(lessons[1]));
// console.log(lessons[1].name, lessons[1].name());
